From: Matthew Garrett Date: Fri, 9 Mar 2012 13:46:50 +0000 (-0500) Subject: asus-wmi: Restrict debugfs interface when securelevel is set X-Git-Tag: archive/raspbian/4.9.13-1+rpi1~11^2~47 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com//%22stanciumarius94%40gmail.com/%22/%22http:/www.example.com/%22stanciumarius94%40gmail.com/%22?a=commitdiff_plain;h=b6bb6738a217da8249f0df625bc5d632e0da54ec;p=linux-4.9.git asus-wmi: Restrict debugfs interface when securelevel is set We have no way of validating what all of the Asus WMI methods do on a given machine, and there's a risk that some will allow hardware state to be manipulated in such a way that arbitrary code can be executed in the kernel. Prevent that if securelevel is set. Signed-off-by: Matthew Garrett Gbp-Pq: Topic features/all/securelevel Gbp-Pq: Name asus-wmi-restrict-debugfs-interface-when-securelevel.patch --- diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index ce6ca31a2d09..d2c175b12a36 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -1872,6 +1873,9 @@ static int show_dsts(struct seq_file *m, void *data) int err; u32 retval = -1; + if (get_securelevel() > 0) + return -EPERM; + err = asus_wmi_get_devstate(asus, asus->debug.dev_id, &retval); if (err < 0) @@ -1888,6 +1892,9 @@ static int show_devs(struct seq_file *m, void *data) int err; u32 retval = -1; + if (get_securelevel() > 0) + return -EPERM; + err = asus_wmi_set_devstate(asus->debug.dev_id, asus->debug.ctrl_param, &retval); @@ -1912,6 +1919,9 @@ static int show_call(struct seq_file *m, void *data) union acpi_object *obj; acpi_status status; + if (get_securelevel() > 0) + return -EPERM; + status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID, 1, asus->debug.method_id, &input, &output);